Build a Drilling UI App
A drilling frontend app follows the selected rig and well in a Corva dashboard. Build against that supplied context first; fetch assets manually only when the workflow intentionally lets the user compare or select something outside the dashboard context.
What Corva supplies
For the drilling segment, Corva UI maps the operational context as follows:
| Context value | Meaning | Common use |
|---|---|---|
rig | The selected drilling rig | Rig name, rig-level metadata, active operation |
well | The active or selected well | asset_id for dataset queries and well metadata |
appSettings | Saved settings for this app instance | Filters, display options, customer choices |
currentUser | Signed-in Corva user, when available | Units, company context, user-aware behavior |
Access these values with useAppCommons from @corva/ui/effects.
1. Confirm the manifest segment
Your generated manifest.json should contain:
{
"application": {
"type": "ui",
"segments": ["drilling"],
"ui": {
"use_app_header_v3": true
}
}
}
Do not add completion to make the same package cover both workflows. The two segments receive different assets and usually require different UX.
2. Render the selected rig and well
Replace the generated placeholder content while keeping the standard container and header:
import { AppContainer, AppHeader, EmptyState } from '@corva/ui/componentsV2';
import { useAppCommons } from '@corva/ui/effects';
export default function App() {
const { appKey, rig, well } = useAppCommons();
if (!well) {
return (
<AppContainer header={<AppHeader />} testId={appKey}>
<EmptyState title="Select a well to view drilling data" />
</AppContainer>
);
}
return (
<AppContainer header={<AppHeader />} testId={appKey}>
<main>
<h2>{well.name}</h2>
<p>Rig: {rig?.name ?? 'No rig selected'}</p>
<p>Asset ID: {well.asset_id}</p>
</main>
</AppContainer>
);
}
AppHeader reads the same Corva UI context, so it can display the app title and current assets without receiving a copied set of app props.
3. Load drilling data for the well
Most drilling datasets use the well's asset_id. A typical app flow is:
- Wait until
wellis available. - Read
well.asset_id. - Query the required dataset with
corvaDataAPIfrom@corva/ui/clients. - Show loading, empty, error, and success states.
- Cancel or ignore outdated requests when the selected well changes.
Use the Data API reference to select the dataset and query parameters. Dev Center frontend apps should use the authenticated clients from @corva/ui; do not embed API keys or Bearer tokens in frontend source code.
4. Respond to asset changes
The customer can switch wells without reloading the whole dashboard. Effects and cached queries that depend on operational data should include well.asset_id in their dependency or query key.
useEffect(() => {
if (!well?.asset_id) return undefined;
const controller = new AbortController();
loadDrillingData(well.asset_id, controller.signal);
return () => controller.abort();
}, [well?.asset_id]);
This prevents a response for the previous well from replacing data for the newly selected well.
5. Add settings only when customers need them
Use AppSettings for persistent customer choices such as curve visibility, units, thresholds, or default ranges. Keep temporary UI state—open panels, hover state, and current tab state—inside the app unless it must survive reloads.
Continue with: